package com.authapi.sample.api.controller;


import com.authapi.sample.api.entity.Role;
import com.authapi.sample.api.model.Response.Common.Result;
import com.authapi.sample.api.service.impl.LogServiceImpl;
import com.authapi.sample.api.service.impl.MenuServiceImpl;
import com.authapi.sample.api.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Statistics")
public class StatisticsController {
    @Autowired
    private UserServiceImpl userService;

    @Autowired
    private MenuServiceImpl menuService;

    @Autowired
    private LogServiceImpl logService;

    //获取用户数量
    @GetMapping("/GetUserCount")
    public Result<Integer> GetUserCount(){
        return Result.Success((int)userService.count());
    }

    //获取菜单数量
    @GetMapping("/GetMenuCount")
    public Result<Integer> GetMenuCount(){
        return Result.Success((int)menuService.count());
    }

    //获取登录次数
    @GetMapping("/GetLoginCount")
    public Result<Integer> GetLoginCount(){
        return Result.Success((int)logService.count());
    }

}
